package com.example.taobaounion.utils;

import android.util.Log;

import com.example.taobaounion.net.Constants;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * @author : Administrator
 * @descreption :
 */
public class RetrofitManager {
    private  Retrofit retrofit = null;
    private static  RetrofitManager ourInstance = null;

    public static RetrofitManager getInstance() {
        if (ourInstance==null){
          ourInstance = new RetrofitManager();
        }
        return ourInstance;
    }

    private RetrofitManager() {
        Log.i("TAG", "RetrofitManager: 创建一次");
           this.retrofit = new Retrofit.Builder()
                   .baseUrl(Constants.BASEURL)
                   .addConverterFactory(GsonConverterFactory.create()) //设置数据解析器
                   ///.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                   .build();
    }


    public Retrofit getRetrofit(){
        return retrofit;
    }

}
